/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.0.4</a>, using an XML
 * Schema.
 * $Id$
 */

package com.jzhao.jpre.format.sequential.castor;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class ISO8583Type.
 * 
 * @version $Revision$ $Date$
 */
public class ISO8583Type implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _msgHead
     */
    private com.jzhao.jpre.format.sequential.castor.MsgHead _msgHead;

    /**
     * Field _msgType
     */
    private com.jzhao.jpre.format.sequential.castor.MsgType _msgType;

    /**
     * Field _bitmap
     */
    private com.jzhao.jpre.format.sequential.castor.Bitmap _bitmap;

    /**
     * Field _msgFieldList
     */
    private java.util.Vector _msgFieldList;


      //----------------/
     //- Constructors -/
    //----------------/

    public ISO8583Type() 
     {
        super();
        this._msgFieldList = new java.util.Vector();
    } //-- com.jzhao.jpre.format.sequential.castor.ISO8583Type()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * 
     * @param vMsgField
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addMsgField(com.jzhao.jpre.format.sequential.castor.MsgField vMsgField)
        throws java.lang.IndexOutOfBoundsException
    {
        // check for the maximum size
        if (this._msgFieldList.size() >= 189) {
            throw new IndexOutOfBoundsException("addMsgField has a maximum of 189");
        }
        
        this._msgFieldList.addElement(vMsgField);
    } //-- void addMsgField(com.jzhao.jpre.format.sequential.castor.MsgField) 

    /**
     * 
     * 
     * @param index
     * @param vMsgField
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addMsgField(int index, com.jzhao.jpre.format.sequential.castor.MsgField vMsgField)
        throws java.lang.IndexOutOfBoundsException
    {
        // check for the maximum size
        if (this._msgFieldList.size() >= 189) {
            throw new IndexOutOfBoundsException("addMsgField has a maximum of 189");
        }
        
        this._msgFieldList.add(index, vMsgField);
    } //-- void addMsgField(int, com.jzhao.jpre.format.sequential.castor.MsgField) 

    /**
     * Method enumerateMsgField
     * 
     * 
     * 
     * @return an Enumeration over all
     * com.jzhao.jpre.format.sequential.castor.MsgField elements
     */
    public java.util.Enumeration enumerateMsgField()
    {
        return this._msgFieldList.elements();
    } //-- java.util.Enumeration enumerateMsgField() 

    /**
     * Returns the value of field 'bitmap'.
     * 
     * @return the value of field 'Bitmap'.
     */
    public com.jzhao.jpre.format.sequential.castor.Bitmap getBitmap()
    {
        return this._bitmap;
    } //-- com.jzhao.jpre.format.sequential.castor.Bitmap getBitmap() 

    /**
     * Method getMsgField
     * 
     * 
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the
     * com.jzhao.jpre.format.sequential.castor.MsgField at the
     * given index
     */
    public com.jzhao.jpre.format.sequential.castor.MsgField getMsgField(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._msgFieldList.size()) {
            throw new IndexOutOfBoundsException("getMsgField: Index value '" + index + "' not in range [0.." + (this._msgFieldList.size() - 1) + "]");
        }
        
        return (com.jzhao.jpre.format.sequential.castor.MsgField) _msgFieldList.get(index);
    } //-- com.jzhao.jpre.format.sequential.castor.MsgField getMsgField(int) 

    /**
     * Method getMsgField
     * 
     * 
     * 
     * @return this collection as an Array
     */
    public com.jzhao.jpre.format.sequential.castor.MsgField[] getMsgField()
    {
        int size = this._msgFieldList.size();
        com.jzhao.jpre.format.sequential.castor.MsgField[] array = new com.jzhao.jpre.format.sequential.castor.MsgField[size];
        for (int index = 0; index < size; index++){
            array[index] = (com.jzhao.jpre.format.sequential.castor.MsgField) _msgFieldList.get(index);
        }
        
        return array;
    } //-- com.jzhao.jpre.format.sequential.castor.MsgField[] getMsgField() 

    /**
     * Method getMsgFieldCount
     * 
     * 
     * 
     * @return the size of this collection
     */
    public int getMsgFieldCount()
    {
        return this._msgFieldList.size();
    } //-- int getMsgFieldCount() 

    /**
     * Returns the value of field 'msgHead'.
     * 
     * @return the value of field 'MsgHead'.
     */
    public com.jzhao.jpre.format.sequential.castor.MsgHead getMsgHead()
    {
        return this._msgHead;
    } //-- com.jzhao.jpre.format.sequential.castor.MsgHead getMsgHead() 

    /**
     * Returns the value of field 'msgType'.
     * 
     * @return the value of field 'MsgType'.
     */
    public com.jzhao.jpre.format.sequential.castor.MsgType getMsgType()
    {
        return this._msgType;
    } //-- com.jzhao.jpre.format.sequential.castor.MsgType getMsgType() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     */
    public void removeAllMsgField()
    {
        this._msgFieldList.clear();
    } //-- void removeAllMsgField() 

    /**
     * Method removeMsgField
     * 
     * 
     * 
     * @param vMsgField
     * @return true if the object was removed from the collection.
     */
    public boolean removeMsgField(com.jzhao.jpre.format.sequential.castor.MsgField vMsgField)
    {
        boolean removed = _msgFieldList.remove(vMsgField);
        return removed;
    } //-- boolean removeMsgField(com.jzhao.jpre.format.sequential.castor.MsgField) 

    /**
     * Method removeMsgFieldAt
     * 
     * 
     * 
     * @param index
     * @return the element removed from the collection
     */
    public com.jzhao.jpre.format.sequential.castor.MsgField removeMsgFieldAt(int index)
    {
        Object obj = this._msgFieldList.remove(index);
        return (com.jzhao.jpre.format.sequential.castor.MsgField) obj;
    } //-- com.jzhao.jpre.format.sequential.castor.MsgField removeMsgFieldAt(int) 

    /**
     * Sets the value of field 'bitmap'.
     * 
     * @param bitmap the value of field 'bitmap'.
     */
    public void setBitmap(com.jzhao.jpre.format.sequential.castor.Bitmap bitmap)
    {
        this._bitmap = bitmap;
    } //-- void setBitmap(com.jzhao.jpre.format.sequential.castor.Bitmap) 

    /**
     * 
     * 
     * @param index
     * @param vMsgField
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setMsgField(int index, com.jzhao.jpre.format.sequential.castor.MsgField vMsgField)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._msgFieldList.size()) {
            throw new IndexOutOfBoundsException("setMsgField: Index value '" + index + "' not in range [0.." + (this._msgFieldList.size() - 1) + "]");
        }
        
        this._msgFieldList.set(index, vMsgField);
    } //-- void setMsgField(int, com.jzhao.jpre.format.sequential.castor.MsgField) 

    /**
     * 
     * 
     * @param vMsgFieldArray
     */
    public void setMsgField(com.jzhao.jpre.format.sequential.castor.MsgField[] vMsgFieldArray)
    {
        //-- copy array
        _msgFieldList.clear();
        
        for (int i = 0; i < vMsgFieldArray.length; i++) {
                this._msgFieldList.add(vMsgFieldArray[i]);
        }
    } //-- void setMsgField(com.jzhao.jpre.format.sequential.castor.MsgField) 

    /**
     * Sets the value of field 'msgHead'.
     * 
     * @param msgHead the value of field 'msgHead'.
     */
    public void setMsgHead(com.jzhao.jpre.format.sequential.castor.MsgHead msgHead)
    {
        this._msgHead = msgHead;
    } //-- void setMsgHead(com.jzhao.jpre.format.sequential.castor.MsgHead) 

    /**
     * Sets the value of field 'msgType'.
     * 
     * @param msgType the value of field 'msgType'.
     */
    public void setMsgType(com.jzhao.jpre.format.sequential.castor.MsgType msgType)
    {
        this._msgType = msgType;
    } //-- void setMsgType(com.jzhao.jpre.format.sequential.castor.MsgType) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled
     * com.jzhao.jpre.format.sequential.castor.ISO8583Type
     */
    public static com.jzhao.jpre.format.sequential.castor.ISO8583Type unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (com.jzhao.jpre.format.sequential.castor.ISO8583Type) Unmarshaller.unmarshal(com.jzhao.jpre.format.sequential.castor.ISO8583Type.class, reader);
    } //-- com.jzhao.jpre.format.sequential.castor.ISO8583Type unmarshal(java.io.Reader) 

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
